//class 关键词

function Person (name){
    this.name = name//通过this访问当前的实例对象
}

Person.prototype.say = function(){//若想在这个类型所有实例之间共享一些成员，借助propertype原型去实现
    console.log(`hi,my name is ${this.name}`)
}

class Person {//定义了person类型
    constructor(name){//当前这个类型的构造函数
        this.name = name
    }

    say(){
        console.log(`hi,my name is ${this.name}`)
    }
}

const p = new Person('tom')
p.say()